<?php 
  if ($_POST['message']) { 
	
	include "../includes/functions.php";
	echo db_connect();
	
	$author = $_POST['author'];
	$message =  $_POST['message']; 
  $result = mysql_query ("INSERT INTO wall VALUES ('',NOW(),'$author','$message')");
  
   mail ('terry@kootenaycoopradio.com', 'New Whiteboard Message', "$message

-$author", "FROM: terry@kootenaycoopradio.com");

  if (!$result) {
	DIE('sql error:'.mysql_error());
	}else{
		header("location:playlists.php");
	}

}  else {
	

 ?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Playlists</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css" media="screen">
body {
		background-image: url("../images/concrete_bg.jpg");
		background-repeat: repeat;
	}
</style>

<script type="text/javascript">   

</script>
    
</head>

<body bgcolor="#eeeeee" onLoad='pickDate()'>
<a href='index.php' style='color:white;font-weight:bold;'>«Cancel Message</a><br><br>  
<div id='wall_form' >
<b>Enter your name and message, then press 'Save Message'.</b><br><br> 
	<form action="#" method='post' autocomplete='off'>
	<div class='form_item'>Your Name:<br><input type="text" name="author" value="" size='30' id="author"></div><br>
	<div class='form_item'>Your Message:<br><textarea name="message" id='message' rows="8" cols="40"></textarea></div> 
    <br><input type="submit" name="submit" value="Save Message" id="submit">
	</form>
</div>

</body>
</html> 

<?php 
}
?>
